package com.zkthink.ceres.order.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author JustArgo
 * @since 2020-05-27
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_goods_return")
@ApiModel(value = "GoodsReturn", description = "")
@AllArgsConstructor
public class GoodsReturn extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("商户编号")
    @TableField("tenant_code")
    private String tenantCode;

    @ApiModelProperty("用户id")
    @TableField(value = "mid")
    private Long mid;

    /**
     * 退款编号
     */
    @ApiModelProperty(value = "退款编号")
    @Length(max = 32, message = "退款编号长度不能超过32")
    @TableField(value = "return_code", condition = LIKE)
    @Excel(name = "退款编号")
    private String returnCode;

    /**
     * 订单id
     */
    @ApiModelProperty(value = "订单id")
    @TableField("order_id")
    @Excel(name = "订单id")
    private Long orderId;

    /**
     * 订单编号
     */
    @ApiModelProperty(value = "订单编号")
    @Length(max = 32, message = "订单编号长度不能超过32")
    @TableField(value = "order_code", condition = LIKE)
    @Excel(name = "订单编号")
    private String orderCode;

    /**
     * 订单商品对应id
     */
    @ApiModelProperty(value = "订单商品对应id")
    @TableField("order_product_ids")
    @Excel(name = "订单商品对应id")
    private String orderProductIds;

    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品id")
    @TableField("product_id")
    @Excel(name = "商品id")
    private Long productId;

    /**
     * 商品编号
     */
    @ApiModelProperty(value = "商品编号")
    @Length(max = 32, message = "商品编号长度不能超过32")
    @TableField(value = "product_code", condition = LIKE)
    @Excel(name = "商品编号")
    private String productCode;

    /**
     * 申请退货的商品数量
     */
    @ApiModelProperty(value = "申请退货的商品数量")
    @TableField("product_count")
    @Excel(name = "申请退货的商品数量")
    private Integer productCount;

    /**
     * 退货状态: 0-退货审核中 1-审核通过,待用户填写物流 2-审核不通过 3-退货中 4-确认收货，待退款 5-退货完成，拒绝退款 6-已退款 7-退款中 8-退款失败 9-撤销申请
     */
    @ApiModelProperty(value = "退货状态: 0-退货审核中 1-审核通过,待用户填写物流 2-审核不通过 3-退货中 4-确认收货，待退款 5-退货完成，拒绝退款 6-已退款 7-退款中 8-退款失败 9-撤销申请")
    @TableField("status")
    @Excel(name = "退货状态: 0-退货审核中 1-审核通过,待用户填写物流 2-审核不通过 3-退货中 4-确认收货，待退款 5-退货完成，拒绝退款 6-已退款 7-退款中 8-退款失败 9-撤销申请")
    private Integer status;

    /**
     * 退货方式: 1-上门取件 2-商家同意退货后再决定
     */
    @ApiModelProperty(value = "退货方式: 1-上门取件 2-商家同意退货后再决定")
    @TableField("return_type")
    @Excel(name = "退货方式: 1-上门取件 2-商家同意退货后再决定")
    private Integer returnType;

    /**
     * 退货原因
     */
    @ApiModelProperty(value = "退货原因")
    @TableField("return_reason")
    @Excel(name = "退货原因")
    private Integer returnReason;

    /**
     * 申请退货时的描述
     */
    @ApiModelProperty(value = "申请退货时的描述")
    @NotEmpty(message = "申请退货时的描述不能为空")
    @Length(max = 255, message = "申请退货时的描述长度不能超过255")
    @TableField(value = "return_money_desc", condition = LIKE)
    @Excel(name = "申请退货时的描述")
    private String returnMoneyDesc;

    /**
     * 填写退货物流时的描述
     */
    @ApiModelProperty(value = "填写退货物流时的描述")
    @NotEmpty(message = "填写退货物流时的描述不能为空")
    @Length(max = 255, message = "填写退货物流时的描述长度不能超过255")
    @TableField(value = "return_goods_desc", condition = LIKE)
    @Excel(name = "填写退货物流时的描述")
    private String returnGoodsDesc;

    /**
     * 确认收到退货时的描述
     */
    @ApiModelProperty(value = "确认收到退货时的描述")
    @Length(max = 255, message = "确认收到退货时的描述长度不能超过255")
    @TableField(value = "confirm_return_goods_desc", condition = LIKE)
    @Excel(name = "确认收到退货时的描述")
    private String confirmReturnGoodsDesc;

    /**
     * 退货所用物流公司的id
     */
    @ApiModelProperty(value = "退货所用物流公司的id")
    @NotNull(message = "退货所用物流公司的id不能为空")
    @TableField("logistics_id")
    @Excel(name = "退货所用物流公司的id")
    private Long logisticsId;

    /**
     * 物流公司编码
     */
    @ApiModelProperty(value = "物流公司编码")
    @NotEmpty(message = "物流公司编码不能为空")
    @Length(max = 32, message = "物流公司编码超过32")
    @TableField(value = "shipper_code", condition = LIKE)
    @Excel(name = "物流公司编码")
    private String shipperCode;

    /**
     * 退货所用物流公司的名称
     */
    @ApiModelProperty(value = "退货所用物流公司的名称")
    @NotEmpty(message = "退货所用物流公司的名称不能为空")
    @Length(max = 32, message = "退货所用物流公司的名称长度不能超过32")
    @TableField(value = "logistics_name", condition = LIKE)
    @Excel(name = "退货所用物流公司的名称")
    private String logisticsName;

    /**
     * 退货物流单号
     */
    @ApiModelProperty(value = "退货物流单号")
    @NotEmpty(message = "退货物流单号不能为空")
    @Length(max = 32, message = "退货物流单号长度不能超过32")
    @TableField(value = "logistics_num", condition = LIKE)
    @Excel(name = "退货物流单号")
    private String logisticsNum;

    /**
     * 审核退款时备注
     */
    @ApiModelProperty(value = "审核退款时备注")
    @NotEmpty(message = "审核退款时备注不能为空")
    @Length(max = 256, message = "审核退款时备注长度不能超过256")
    @TableField(value = "return_money_remark", condition = LIKE)
    @Excel(name = "审核退款时备注")
    private String returnMoneyRemark;

    /**
     * 审核退货时的备注
     */
    @ApiModelProperty(value = "审核退货时的备注")
    @NotEmpty(message = "审核退货时的备注不能为空")
    @Length(max = 256, message = "审核退货时的备注长度不能超过256")
    @TableField(value = "return_goods_remark", condition = LIKE)
    @Excel(name = "审核退货时的备注")
    private String returnGoodsRemark;

    /**
     * 第三方退款单号
     */
    @ApiModelProperty(value = "第三方退款单号")
    @NotEmpty(message = "第三方退款单号不能为空")
    @Length(max = 256, message = "第三方退款单号长度不能超过256")
    @TableField(value = "third_return_no", condition = LIKE)
    @Excel(name = "第三方退款单号")
    private String thirdReturnNo;

    /**
     * 退货申请金额
     */
    @ApiModelProperty(value = "退货申请金额")
    @NotNull(message = "退货申请金额不能为空")
    @TableField("apply_sum")
    @Excel(name = "退货申请金额")
    private Long applySum;

    /**
     * 真实退款金额
     */
    @ApiModelProperty(value = "真实退款金额")
    @NotNull(message = "真实退款金额不能为空")
    @TableField("real_return_sum")
    @Excel(name = "真实退款金额")
    private Long realReturnSum;

    /**
     * 退货时间，客户填写退货单号的时间
     */
    @ApiModelProperty(value = "退货时间，客户填写退货单号的时间")
    @TableField("return_goods_time")
    @Excel(name = "退货时间，客户填写退货单号的时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime returnGoodsTime;

    /**
     * 退款到账时间
     */
    @ApiModelProperty(value = "退款到账时间")
    @TableField("return_money_time")
    @Excel(name = "退款到账时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime returnMoneyTime;

    /**
     * 审核退款的时间
     */
    @ApiModelProperty(value = "审核退款的时间")
    @TableField("audit_money_time")
    @Excel(name = "审核退款的时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime auditMoneyTime;

    /**
     * 审核退货的时间
     */
    @ApiModelProperty(value = "审核退货的时间")
    @TableField("audit_goods_time")
    @Excel(name = "审核退货的时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime auditGoodsTime;

    /**
     * 申请退货的时间
     */
    @ApiModelProperty(value = "申请退货的时间")
    @NotNull(message = "申请退货的时间不能为空")
    @TableField("apply_time")
    @Excel(name = "申请退货的时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime applyTime;

    /**
     * 申请退货上传的图片
     */
    @ApiModelProperty(value = "申请退货上传的图片")
    @NotEmpty(message = "申请退货上传的图片不能为空")
    @Length(max = 256, message = "申请退货上传的图片长度不能超过256")
    @TableField(value = "return_imgs", condition = LIKE)
    @Excel(name = "申请退货上传的图片")
    private String returnImgs;

    /**
     * 填写退货物流时的凭证
     */
    @ApiModelProperty(value = "填写退货物流时的凭证")
    @NotEmpty(message = "填写退货物流时的凭证不能为空")
    @Length(max = 255, message = "填写退货物流时的凭证长度不能超过255")
    @TableField(value = "send_goods_imgs", condition = LIKE)
    @Excel(name = "填写退货物流时的凭证")
    private String sendGoodsImgs;

    /**
     * 当前版本，同一个订单可以申请多次，最近申请的为0
     */
    @ApiModelProperty(value = "当前版本，同一个订单可以申请多次，最近申请的为0")
    @NotNull(message = "当前版本，同一个订单可以申请多次，最近申请的为0不能为空")
    @TableField("current_version")
    @Excel(name = "当前版本，同一个订单可以申请多次，最近申请的为0")
    private Integer currentVersion;

    /**
     * 逻辑删除：1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除：1-删除 0-未删除")
    @NotNull(message = "逻辑删除：1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除：1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public GoodsReturn(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime, 
                    String returnCode, Long orderId, String orderCode, String orderProductIds, Long productId,
                    String productCode, Integer productCount, Integer status, Integer returnType, Integer returnReason, String returnMoneyDesc, 
                    String returnGoodsDesc, String confirmReturnGoodsDesc, Long logisticsId, String shipperCode, String logisticsName, String logisticsNum, String returnMoneyRemark,
                    String returnGoodsRemark, String thirdReturnNo, Long applySum, Long realReturnSum, LocalDateTime returnGoodsTime, LocalDateTime returnMoneyTime, 
                    LocalDateTime auditMoneyTime, LocalDateTime auditGoodsTime, LocalDateTime applyTime, String returnImgs, String sendGoodsImgs, Integer currentVersion, Integer isDelete) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.returnCode = returnCode;
        this.orderId = orderId;
        this.orderCode = orderCode;
        this.orderProductIds = orderProductIds;
        this.productId = productId;
        this.productCode = productCode;
        this.productCount = productCount;
        this.status = status;
        this.returnType = returnType;
        this.returnReason = returnReason;
        this.returnMoneyDesc = returnMoneyDesc;
        this.returnGoodsDesc = returnGoodsDesc;
        this.confirmReturnGoodsDesc = confirmReturnGoodsDesc;
        this.logisticsId = logisticsId;
        this.shipperCode = shipperCode;
        this.logisticsName = logisticsName;
        this.logisticsNum = logisticsNum;
        this.returnMoneyRemark = returnMoneyRemark;
        this.returnGoodsRemark = returnGoodsRemark;
        this.thirdReturnNo = thirdReturnNo;
        this.applySum = applySum;
        this.realReturnSum = realReturnSum;
        this.returnGoodsTime = returnGoodsTime;
        this.returnMoneyTime = returnMoneyTime;
        this.auditMoneyTime = auditMoneyTime;
        this.auditGoodsTime = auditGoodsTime;
        this.applyTime = applyTime;
        this.returnImgs = returnImgs;
        this.sendGoodsImgs = sendGoodsImgs;
        this.currentVersion = currentVersion;
        this.isDelete = isDelete;
    }

}
